<?php
namespace Swiftx\Bundle\WeChat\Factory;
use Swiftx\Bundle\WeChat\Interfaces\Common\BaseFactory;
use Swiftx\Bundle\WeChat\Model\Mall\Goods as Entity;
use Swiftx\Interfaces\Orm\Query;

/**
 * 管理员工厂实现类
 */
class Goods extends BaseFactory {

    /**
     * 设置实体类型
     * @return string
     */
    public function setEntityClass(): string {
        return Entity::class;
    }

    /**
     * 通过企业获取查询器
     * @param array $params
     * @return Query
     */
    public function queryByCompany(array $params) : Query{
        $query = $this->query('EqualByCompany');
        $query->bind('company', $params['company']);
        if(isset($params['sellTime']))
            $query->bind('sellTime', $params['sellTime']);
        return $query;
    }

}